﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace test
{
    public class TestEntity
    {

        private static Random random;
        private static string[] names = {
                                            "JAMES",
                                            "JOHN",
                                            "ROBERT",
                                            "MICHAEL",
                                            "WILLIAM",
                                            "DAVID",
                                            "RICHARD",
                                            "CHARLES",
                                            "JOSEPH",
                                            "THOMAS",
                                            "MARY",
                                            "PATRICIA",
                                            "LINDA",
                                            "BARBARA",
                                            "ELIZABETH",
                                            "JENNIFER",
                                            "MARIA",
                                            "SUSAN",
                                            "MARGARET",
                                            "DOROTHY",
                                            "SMITH",
                                            "JOHNSON",
                                            "WILLIAMS",
                                            "JONES",
                                            "BROWN",
                                            "DAVIS",
                                            "MILLER",
                                            "WILSON",
                                            "MOORE",
                                            "TAYLOR"
                                        };

        static TestEntity()
        {
            random = new Random();
        }

        private static string GetRandomName()
        {
            return names[random.Next( 0, names.Count() - 1 )];
        }
        private static DateTime GetRandomDate()
        {
            DateTime start = new DateTime( 1970, 1, 1 );
            int range = ( ( TimeSpan )( DateTime.Today - start ) ).Days;
            return start.AddDays( random.Next( range ) );
        }
        public static TestEntity Create( int id = 0 )
        {
            string name = GetRandomName();
            string surName = GetRandomName();
            int age = random.Next( 16, 122 );
            DateTime dateOfBirth = GetRandomDate();
            return new TestEntity() { ID = id, Name = name, SurName = surName, Age = age, DateOfBirth = dateOfBirth };
        }
        public static IEnumerable<TestEntity> Create()
        {
            for ( int i = 0; i < random.Next( 10, 1000 ); i++ )
            {
                yield return Create( i + 1 );
            }
        }


        public int ID { get; set; }
        public string Name { get; set; }
        public string SurName { get; set; }
        public int Age { get; set; }
        public DateTime DateOfBirth { get; set; }

    }
}
